package com.jack.charging.order.controller;

import com.jack.charging.common.pojo.JsonResult;
import com.jack.charging.order.pojo.param.OrderAddParam;
import com.jack.charging.order.service.OrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Jack
 * @date 2025/2/7 17:50
 * @see
 * @since
 */
@RestController
@RequestMapping("/order")
@Api(tags = "订单模块")
@Slf4j
public class OrderController {
    @Autowired
    private OrderService orderService;
    @ApiOperation(value = "创建订单")
    @PostMapping("/create")
    public JsonResult createOrder(@RequestBody OrderAddParam orderAddParam) {
        log.debug("创建订单-orderService:入参:{}", orderAddParam);
        String orderNo = orderService.createOrder(orderAddParam);
        log.debug("创建订单-orderService:出参:{}", orderNo);
        return JsonResult.ok(orderNo, "创建订单成功");
    }

}
